package com.jt.travel.store.controller;

import com.jt.travel.common.pojo.TUser;
import com.jt.travel.store.service.CartService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.Map;

@Controller
@RequestMapping("/cart")
public class CartController {
    @Resource
    CartService cartService;
    @GetMapping("/byUserid")
    @ResponseBody
    public Map byUserid( HttpSession session){
        TUser loginUser = (TUser)session.getAttribute("loginUser");
        Integer userId = loginUser.getUserId();
        Map routeListByid=cartService.byUserid(userId);
        routeListByid.put("status",200);
        return routeListByid;
    }
}
